import time
import  multiprocessing

my_list = []

def write_data():
    for i in range(3):
        my_list.append(i)
        print('add: ',i)
    print(my_list)

def read_data():
    print(my_list)

if __name__ == '__main__':
    write_process = multiprocessing.Process(target=write_data)
    read_process = multiprocessing.Process(target=read_data)
    write_process.start()
    time.sleep(1)
    read_process.start()
    #主进程中的全局变量
    print(my_list)
